<template>
    <div class="header-content">
        <div class="l-panel">
            <el-button style="margin-right:20px" @click="HoldMenu" icon="el-icon-menu" size="mini"/>
            <!-- 面包屑 -->
            <el-breadcrumb separator="/">
                <el-breadcrumb-item v-for="tag in tags" :key="tag.name" :to="{ path: tag.path }">
                    {{tag.label}}
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="r-panel">
            <el-dropdown @command='clickHead'>
                <span class="el-dropdown-link">
                    <img class="img-panel" src="../assets/user.png" alt="">
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>个人中心</el-dropdown-item>
                    <el-dropdown-item command='logout'>退出</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </div>
</template>

<script>
import Cookie from 'js-cookie'
import { mapState, mapActions } from 'vuex'
export default {
    name:'HeaderModel',
    data() {
        return {
        }
    },
    methods: {
        ...mapActions(['HoldMenu', ]),
        // OnClickBtn(){
        //     this.$store.commit('HoldMenu')
        // }
        clickHead(command){
            if (command==='logout'){
                Cookie.remove('token')
                Cookie.remove('menu')
                this.$router.push('login')
            }
        }
    },
    computed: {
        ...mapState({
            tags: state => state.tab.tabList,
        })
    },
}
</script>

<style lang="less" scoped>
.header-content{
    padding: 0 20px;
    background-color: #333;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .text{
        color: #fff;
        font-size: 14px;
        margin-left: 10px;
    }
    .img-panel{
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
    .l-panel{
        display: flex;
        align-items: center;
        /deep/.el-breadcrumb__item{
            .el-breadcrumb__inner{
                font-weight: normal;
                &.is-link{
                    color:#666
                }
            }
            &:last-child{
                .el-breadcrumb__inner{
                    color:#fff
                }
            }
        }
    }
}
</style>